require 'ronin/post_exploitation/io'

class FakeIO
  
  include Ronin::PostExploitation::IO

  def initialize
    @index = 0
    @blocks = ["one\n", "two\nthree\n", "four\n"]

    io_initialize
  end

  protected

  def io_open
    3
  end

  def io_read
    unless (block = @blocks[@index])
      raise(EOFError,"end of stream")
    end

    @index += 1
    return block
  end

  def io_write(data)
    @blocks[@index] = data
    @index += 1

    return data.length
  end

end
